#pragma once

#include <map>
#include <CString>

static const int kPoolSize = 5;
static const char * kDBPool[ kPoolSize ] = { "DBPOOL0" , "DBPOOL1", "DBPOOL2", "DBPOOL3", "DBPOOL4" };

class CConnectionPool;
class CAdoConnection;

class CManager
{
public:
	static CManager & instance( );
	CString GetConnectionName( int index = 0 );
	CAdoConnection * GetConnection( int index = 0 );
	CAdoConnection * GetConnection( const CString & key = kDBPool[0] );
	BOOL ReleaseConnection( int index , CAdoConnection * pCon );
	BOOL ReleaseConnection( const CString & key , CAdoConnection * pCon );

protected:
	CManager( );
	~CManager( );
	CManager( const CManager & ){ };
	const CManager & operator=( const CManager & ){ };

private:
	BOOL InitConfig( );

protected:
	std::map<CString , CConnectionPool * > m_mapConnPool;
};

